/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.cxhd.lis.model.newmodel;

import com.cxhd.lis.util.DateUtil;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Model;
import com.jfinal.plugin.activerecord.Record;
import java.util.Date;
import java.util.List;

/**
 *
 * @author cxhd
 */
@SuppressWarnings("serial")
public class LisProfiletest extends Model<LisProfiletest> {
    public static final LisProfiletest lisProfiletestdao=new LisProfiletest();
    
    public void deleteLisProfiletest(int pk){
        Db.use("mysql").update("delete from lis_profiletest where pk=?",pk);
    }
    public void saveLisProfiletest(String PROFILENAME,String PROFILECODE,String PROFILEDESCRIBE,
            String DEVICEID,String DATAWINDOWNAME,String SECTION,String SAMPLETYPE,
            String DEFINPUT,String BJMC,String DEFNOTE,String DEFHYXM,String NOTES){
        
        
               set("PROFILENAME",PROFILENAME)
               .set("PROFILECODE", PROFILECODE)
                .set("PROFILEDESCRIBE",PROFILEDESCRIBE)
                .set("DEVICEID", DEVICEID)
                .set("DATAWINDOWNAME", DATAWINDOWNAME)
                .set("SECTION", SECTION)
                .set("SAMPLETYPE", SAMPLETYPE)
                .set("DEFINPUT", DEFINPUT)
                .set("BJMC", BJMC)
                .set("DEFNOTE", DEFNOTE)
                .set("DEFHYXM", DEFHYXM)
                .set("NOTES", NOTES)
                .set("INUREDATE", DateUtil.dateFormat(new Date()))
                .save();
    }
    public void updateLisProfiletest(String PK,String PROFILENAME,String PROFILECODE,String PROFILEDESCRIBE,
            String DEVICEID,String DATAWINDOWNAME,String SECTION,String SAMPLETYPE,
            String DEFINPUT,String BJMC,String DEFNOTE,String DEFHYXM,String NOTES){
        findById(PK)
                .set("PROFILENAME",PROFILENAME)
               .set("PROFILECODE", PROFILECODE)
                .set("PROFILEDESCRIBE",PROFILEDESCRIBE)
                .set("DEVICEID", DEVICEID)
                .set("DATAWINDOWNAME", DATAWINDOWNAME)
                .set("SECTION", SECTION)
                .set("SAMPLETYPE", SAMPLETYPE)
                .set("DEFINPUT", DEFINPUT)
                .set("BJMC", BJMC)
                .set("DEFNOTE", DEFNOTE)
                .set("DEFHYXM", DEFHYXM)
                .set("NOTES", NOTES)
                .update();
    }
//    public String getPk(){
//         List<Record> list=Db.use("mysql").find("select * from lis_profiletest limit 0,10");
//        String  value = "1";
//        if(list.size()>0){
//        value = (Integer.parseInt(Db.use("mysql").findFirst("SELECT MAX(pk) as id from lis_profiletest ").get("id") + "") + 1) + "";
//        }
//      return value;
//    }
}
